﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;

namespace VietStar.Library.Commom.Module
{
    public static class FindControls
    {
        public static Control Find(string controlName, Control root)
        {
            if (root == null)
            {
                return null;
            }
            Control returnControl = root.FindControl(controlName);
            if (returnControl != null)
            {
                return returnControl;
            }
            else
            {
                foreach (Control childControl in root.Controls)
                {
                    return Find(controlName, childControl);
                }
            }
            return null;
        }
    }
}
